package cn.chen.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                //添加映射路径
                .allowedHeaders("*")
                //允许请求的头部
                .allowedMethods("*")
                //放行那些域
                .allowedOriginPatterns("*")
                //允许Cookie
                .allowCredentials(true);
    }
}

